Stream class libraryInheritance relationshipThere are more input streams and output streams in Java, we generally only need to master 17 kinds offileinputstream//file byte output streamfileoutputstream//file byte output streamFileReader//file character input streamFileWriter//file character output streambufferedreader//Cache character Input streambufferedwriter//Cache Character Output streambufferedinputstream//Cache byte Input streambufferedoutputstream//Cache byte output streamdatainputstream
Java input/output streamPre-knowledge preparation1. Basic Java SyntaxBasic principle:While the program is running, it may be necessary to read the required data from an external storage medium or other program, which requires the use of an input stream object. The input stream points to the source called it, and the program reads the source data from the input stream that points to the source. On the other hand, after processing the data, the program may need to write processing results to a per
the header tag is in use, some browsers will directly recognize it as a string display.
response.setheader ( "Content-type" "Text/html;charset=utf-8" response.getOut Putstream (). Write ( " Chinese garbled " .getbytes ( "UTF-8"
directly set the value within the label Response.setcontenttype (); è recommended use of response.setcontenttype (" Text/html;charset=utf-8 " response.getOut
Concept of Flow:1. An in Putstream that operates on a byte. out Putstream class in is the reading data, out is the output data, the number is easy to confuse.The most common subclasses of InputStream and OutputStreamFileInputStream and FileOutputStream working with byte dataDataInputStream can be used in binary operation2. Reader.writer class for string manipulationReader.writer subclasses Bufferedreader.
IOException30 */31 private void Downloadfilebyoutputstream (Httpser Vletresponse response) 32 Throws FileNotFoundException, IOException {33//1. Gets the absolute path of the file to download. String Realpath = THIS.GETSERVL Etcontext (). Getrealpath ("/download/1.jpg"); 35//2. Gets the filename to download. String filename = realpath.substring (realpat H.lastindexof ("\ \") +1); 37//3. Setting the Content-disposition response header to control the browser to download the form of open
(Httpser Vletresponse response) 32 Throws FileNotFoundException, IOException {33//1. Gets the absolute path of the file to download. String Realpath = THIS.GETSERVL Etcontext (). Getrealpath ("/download/1.jpg"); 35//2. Gets the filename to download. String filename = realpath.substring (realpat H.lastindexof ("\ \") +1); 37//3. Setting the Content-disposition response header to control the browser to download the form of open file Response.setheader ("Content-dispos Ition "," attachm
(Httpser Vletresponse response) 32 Throws FileNotFoundException, IOException {33//1. Gets the absolute path of the file to download. String Realpath = THIS.GETSERVL Etcontext (). Getrealpath ("/download/1.jpg"); 35//2. Gets the filename to download. String filename = realpath.substring (realpat H.lastindexof ("\ \") +1); 37//3. Setting the Content-disposition response header to control the browser to download the form of open file Response.setheader ("Content-dispos Ition "," attachm
(Httpser Vletresponse response) 32 Throws FileNotFoundException, IOException {33//1. Gets the absolute path of the file to download. String Realpath = THIS.GETSERVL Etcontext (). Getrealpath ("/download/1.jpg"); 35//2. Gets the filename to download. String filename = realpath.substring (realpat H.lastindexof ("\ \") +1); 37//3. Setting the Content-disposition response header to control the browser to download the form of open file Response.setheader ("Content-dispos Ition "," attachm
IOException30 */31 private void Downloadfilebyoutputstream (Httpser Vletresponse response) 32 Throws FileNotFoundException, IOException {33//1. Gets the absolute path of the file to download. String Realpath = THIS.GETSERVL Etcontext (). Getrealpath ("/download/1.jpg"); 35//2. Gets the filename to download. String filename = realpath.substring (realpat H.lastindexof ("\ \") +1); 37//3. Setting the Content-disposition response header to control the browser to download the form of open
have been cracked! Able to execute the su command.1. Create a method: the code is as follows:
Package CN. ycmoon. utility; import Java. io. dataoutputstream; import android. app. activity; import android. util. log; public class systemmanager extends activity {/*** the application program run command to obtain the root permission. The device must have cracked (get the root permission) * @ Param command: string apkroot = "chmod 777" + getpackagecodepath (); rootcommand (apkroot); * @ return appl
1.What is stream?Drain a very image of the concept, when the program needs to read the data, it will open a stream to the data source, the data source can be a file, memory, or network connection. Similarly, when a program needs to write data, it opens a stream to the destination.In Java, the part of Io is large and consists of two main parts: byte stream and character stream. Concrete structure such as (image from the Internet):2: What is a byte stream?A stream that is transmitted in bytes. The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.